/**
	* Copyright (c) minuteproject, minuteproject@gmail.com
	* All rights reserved.
	* 
	* Licensed under the Apache License, Version 2.0 (the "License")
	* you may not use this file except in compliance with the License.
	* You may obtain a copy of the License at
	* 
	* http://www.apache.org/licenses/LICENSE-2.0
	* 
	* Unless required by applicable law or agreed to in writing, software
	* distributed under the License is distributed on an "AS IS" BASIS,
	* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	* See the License for the specific language governing permissions and
	* limitations under the License.
	* 
	* More information on minuteproject:
	* twitter @minuteproject
	* wiki http://minuteproject.wikispaces.com 
	* blog http://minuteproject.blogspot.net
	* 
*/
/**
	* template reference : 
	* - name : OpenxavaDomainObjectUML
	* - file name : DomainObjectUMLJPAAnnotationOXAnnotationV4.vm
*/
package sistema_oficial.sistema_oficial.domain.sistemaoficial;

//MP-MANAGED-ADDED-AREA-BEGINNING @import@
//MP-MANAGED-ADDED-AREA-ENDING @import@
import java.sql.*;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;

import javax.persistence.*;
import org.openxava.annotations.*;

import sistema_oficial.sistema_oficial.domain.sistemaoficial.PagoCalculado;
import sistema_oficial.sistema_oficial.domain.sistemaoficial.Periodo;
import sistema_oficial.sistema_oficial.domain.sistemaoficial.Puesto;

/**
 *
 * <p>Title: Planilla</p>
 *
 * <p>Description: Domain Object describing a Planilla entity</p>
 *
 */
@Entity (name="Planilla")
@Table (name="planilla")
@Views({
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @view-base-planilla@
	@View(
		name="base",
		members=
        "" 	
        + "identificador  ; "
        + "periodoIdentificador  ; "
        + "totalDevengado  ; "
        + "totalLiquido  ; "
        + "observaciones  ; "
        + "puestoIdentificador  ; "
		),
//MP-MANAGED-UPDATABLE-ENDING
	@View(
		name="Create", 
		extendsView="base"
	),
	@View(
		name="Update", 
		extendsView="base",
        members=
          "" 	
	    + "pagoCalculadoPlanillaViaPlanillaIdentificador { pagoCalculadoPlanillaViaPlanillaIdentificador };" 
	),
	@View(extendsView="base",
        members=
          "" 	
	    + "pagoCalculadoPlanillaViaPlanillaIdentificador { pagoCalculadoPlanillaViaPlanillaIdentificador };" 
	),
    @View(name="planillaDEFAULT_VIEW", 
	   members=
          " identificador ;" 	
        + "totalDevengado  ; "
        + "totalLiquido  ; "
        + "observaciones  ; "
	),
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @view-reference-planilla@
    @View(name="reference", 
       extendsView="planillaDEFAULT_VIEW"
//MP-MANAGED-UPDATABLE-ENDING
    )
})

@Tabs({
@Tab(
properties=
     " totalDevengado "
    +",  totalLiquido "
    +",  observaciones "
)
,
@Tab(
name = "PlanillaTab",
properties=
     " totalDevengado "
    +",  totalLiquido "
    +",  observaciones "
)
,
@Tab(
name = "PlanillaTabWithRef",
properties=
     " totalDevengado "
    +",  totalLiquido "
    +",  observaciones "
)
})
//MP-MANAGED-ADDED-AREA-BEGINNING @class-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @class-annotation@
public class Planilla {

    @Hidden @Id @Column(name="identificador" )
    private Integer identificador; 

//MP-MANAGED-ADDED-AREA-BEGINNING @total_devengado-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @total_devengado-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-total_devengado@
    @Column(name="total_devengado",  length=100,  nullable=true,  unique=false)
    private String totalDevengado;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @total_liquido-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @total_liquido-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-total_liquido@
    @Column(name="total_liquido",  length=100,  nullable=true,  unique=false)
    private String totalLiquido;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @observaciones-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @observaciones-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-observaciones@
    @Column(name="observaciones",  length=100,  nullable=true,  unique=false)
    private String observaciones;	
//MP-MANAGED-UPDATABLE-ENDING


//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @parent-Periodo-planilla@
    @ManyToOne (fetch=FetchType.LAZY ,optional=false) //remove optional=false to aggragate but leads to a side effect when going directly to the entity: required check is not performed=> if no set DB check constraint is raised...
    @JoinColumn(name="periodo_identificador", nullable=false,  unique=false  )
    @ReferenceView ("reference") 
    private Periodo periodoIdentificador; 
    
//MP-MANAGED-UPDATABLE-ENDING
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @parent-Puesto-planilla@
    @ManyToOne (fetch=FetchType.LAZY ,optional=false) //remove optional=false to aggragate but leads to a side effect when going directly to the entity: required check is not performed=> if no set DB check constraint is raised...
    @JoinColumn(name="puesto_identificador", nullable=false,  unique=false  )
    @ReferenceView ("reference") 
    private Puesto puestoIdentificador; 
    
//MP-MANAGED-UPDATABLE-ENDING
//children
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @child-pagoCalculadoPlanillaViaPlanillaIdentificador-planilla@
    @OneToMany (targetEntity=sistema_oficial.sistema_oficial.domain.sistemaoficial.PagoCalculado.class, fetch=FetchType.LAZY, mappedBy="planillaIdentificador", cascade=CascadeType.REMOVE)//, cascade=CascadeType.ALL)
    private Set <PagoCalculado> pagoCalculadoPlanillaViaPlanillaIdentificador = new HashSet<PagoCalculado>(); 
   
//MP-MANAGED-UPDATABLE-ENDING
//m2m
    /**
    * Default constructor
    */
    public Planilla() {
    }


    public Integer getIdentificador() {
        return identificador;
    }
	
    public void setIdentificador (Integer identificador) {
        this.identificador =  identificador;
    }
    

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-total_devengado@
    public String getTotalDevengado() {
        return totalDevengado;
    }
	
    public void setTotalDevengado (String totalDevengado) {
        this.totalDevengado =  totalDevengado;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-total_liquido@
    public String getTotalLiquido() {
        return totalLiquido;
    }
	
    public void setTotalLiquido (String totalLiquido) {
        this.totalLiquido =  totalLiquido;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-observaciones@
    public String getObservaciones() {
        return observaciones;
    }
	
    public void setObservaciones (String observaciones) {
        this.observaciones =  observaciones;
    } 
//MP-MANAGED-UPDATABLE-ENDING


    public Periodo getPeriodoIdentificador () {  //
    	return periodoIdentificador;
    }
	
    public void setPeriodoIdentificador (Periodo periodoIdentificador) {
    	this.periodoIdentificador = periodoIdentificador;//this.periodoIdentificador = periodo;
    }
    public Puesto getPuestoIdentificador () {  //
    	return puestoIdentificador;
    }
	
    public void setPuestoIdentificador (Puesto puestoIdentificador) {
    	this.puestoIdentificador = puestoIdentificador;//this.puestoIdentificador = puesto;
    }

    public Set<PagoCalculado> getPagoCalculadoPlanillaViaPlanillaIdentificador() {
        if (pagoCalculadoPlanillaViaPlanillaIdentificador == null){
            pagoCalculadoPlanillaViaPlanillaIdentificador = new HashSet<PagoCalculado>();
        }
        return pagoCalculadoPlanillaViaPlanillaIdentificador;
    }

    public void setPagoCalculadoPlanillaViaPlanillaIdentificador (Set<PagoCalculado> pagoCalculadoPlanillaViaPlanillaIdentificador) {
        this.pagoCalculadoPlanillaViaPlanillaIdentificador = pagoCalculadoPlanillaViaPlanillaIdentificador;
    }	
    
    public void addPagoCalculadoPlanillaViaPlanillaIdentificador (PagoCalculado pagoCalculado) {
    	    getPagoCalculadoPlanillaViaPlanillaIdentificador().add(pagoCalculado);
    }
    



//MP-MANAGED-ADDED-AREA-BEGINNING @implementation@
//MP-MANAGED-ADDED-AREA-ENDING @implementation@

}
